//
//  SEGOrderDetailManager.m
//  ExcellentHome
//
//  Created by Chiang on 2017/11/21.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGOrderDetailManager.h"
#import "SEGWorkOrderUrlList.h"
#import "SEGWorkOrderPayListModel.h"

@implementation SEGOrderDetailManager

+ (instancetype)sharedManager{
    static SEGOrderDetailManager *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[self alloc] init];
    });
    
    return instance;
}

/**
 获取工单基本信息
 @param finished 回调
 */
-(void)getOrderBaseInfoWith:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:API_NEW_ORDER_BASEINFO parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 获取我的工单详情
 @param finished 回调
 */
-(void)getOrderDetailWith:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:API_NEW_ORDER_DETAILINFO parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 获取工单轨迹
 @param finished 回调
 */
-(void)getOrderTrackListWith:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:GET
                                            URLString:API_NEW_ORDER_TRACKLIST
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                             }];
}

/**
 获取动作列表
 @param finished 回调
 */
-(void)getActionListWith:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:API_NEW_ORDER_ACTIONS
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                             }];
}

/**
 工单处理提交
 @param finished 回调
 */
-(void)handleOrderWith:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:API_NEW_ORDER_SUBMIT_ORDER_DETAIL
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                             }];
}

/**
 评价环节如果评论是>3星，分享给帮帮赞赞
 NODE_DS_EVLUATE 评价
 */
-(void)praiseForEvaluate:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestWithMethod:POST URLString:ACTION_HELPVIEWCONTROLLER_QUESTION_SAVE parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 获取支付详情
 @param finished 回调
 */
-(void)queryPayDetail:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:API_NEW_ORDER_PAY_DETAIL parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 获取支付列表
 @param finished 回调
 */
-(void)getPayMethodList:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:API_NEW_ORDER_PAY_METHOD_LIST parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 4.8.0 获取新的支付列表
 @param finished 回调
 */
-(void)getNewPayMethodList:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:API_NEWEST_ORDER_PAY_METHOD_LIST parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 支付订单
 @param finished 回调
 */
-(void)servicePay:(NSDictionary *)params finished:(SEGNetworkReponse)finished
{
    [SEGHTTPBusinessManager seg_requestWithMethod:POST URLString:API_NEW_ORDER_SERVICE_PAY parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}


/**
 物业服务合并账单支付

 @param params 请求参数
 @param finished 请求完成的回调
 */
- (void)combineBillPay:(NSDictionary *)params finished:(SEGNetworkReponse)finished {
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST URLString:API_ORDER_COMBINE_BILL_PAY parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}


/**
 物业服务在线缴费支付

 @param params 请求参数
 @param finished 回调
 */
- (void)onlinePay:(NSDictionary *)params finished:(SEGNetworkReponse)finished {
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST URLString:API_ORDER_ONLINE_PAY parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}


/// 工单撤单
/// @param params 请求参数
/// @param finished 回调
- (void)requestCancelOrder:(NSDictionary *)params finished:(SEGNetworkReponse)finished {
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST URLString:API_ORDER_CANCLE parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

@end
